import axios from '@/libs/api.request'
import cookie from "vux/src/tools/cookie";

//获取论坛轮播图列表
export const getSlider = () =>{
  return axios.request({
    url:'forum/getSliderList',
    noToken:true,
    method: 'post',
  })
}
//获取论坛文章列表
export const getForumArticle = () =>{
  return axios.request({
    url:'forum/getArticleList',
    noToken:true,
    method: 'post',
  })
}
//获取文章分类列表
export const getArticleCateList = () =>{
  return axios.request({
    url:'forum/getArticleCateList',
    noToken:true,
    method:'post',
  })
}
//获取文字详情
export const getArticleDetail = ({id,cid}) =>{
  const data={
    id,
    cid
  }
  return axios.request({
    url:'forum/getArticleDetail',
    data,
    method:'post',
  })
}
//获取文字评论列表
export const getArticleCommentList = (articleId) =>{
  return axios.request({
    url:'forum/getArticleCommentList',
    data:{articleId},
    method:'post',
  })
}
//收藏文章/取消收藏
export const collect = ({articleId,cid})=>{
  const data={
    articleId,
    cid
  }
  return axios.request({
    url:'forum/collect',
    data,
    method:'post',
  })
}
//发表评论
export const addArticleComment = ({articleType,articleId,commenterId,commentContent})=>{
  const  data={
    articleType,
    articleId,
    commenterId,
    commentContent,
  }
  return axios.request({
    url:'forum/addArticleComment',
    data,
    method:'post',
  })
}
//回复
export const addArticleReply = ({articleId,commentId,content,cid,ToCid})=>{
  const data={
    articleId,
    commentId,
    content,
    cid,
    ToCid
  }
  return axios.request({
    url:'forum/addArticleReply',
    data,
    method:'post'
  })
}
//发布文章
export const addArticle = ({cid,pictureArray,content,articleCategoryId,longitude,latitude})=>{
  const data={
    cid,
    pictureArray,
    content,
    articleCategoryId,
    longitude,
    latitude
  }
  return axios.request({
    url:'forum/addArticle',
    data,
    method:'post'
  })
}
